<HTML>
<HEAD>
<TITLE>[Chapter 21] PaintEvent </TITLE>
<META NAME="author" CONTENT="John Zukowski">
<META NAME="date" CONTENT="Thu Jul 31 15:22:30 1997">
<META NAME="form" CONTENT="html">
<META NAME="metadata" CONTENT="dublincore.0.1">
<META NAME="objecttype" CONTENT="book part">
<META NAME="otheragent" CONTENT="gmat dbtohtml">
<META NAME="publisher" CONTENT="O'Reilly &amp; Associates, Inc.">
<META NAME="source" CONTENT="SGML">
<META NAME="subject" CONTENT="Java AWT">
<META NAME="title" CONTENT="Java AWT">
<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript">
</HEAD>
<body vlink="#551a8b" alink="#ff0000" text="#000000" bgcolor="#FFFFFF" link="#0000ee">

<DIV CLASS=htmlnav>
<H1><a href='index.htm'><IMG SRC="gifs/smbanner.gif"
     ALT="Java AWT" border=0></a></H1>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch21_24.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><B><FONT FACE="ARIEL,HELVETICA,HELV,SANSERIF" SIZE="-1">Chapter 21<br>java.awt.event Reference</FONT></B></TD>
<td width=172 align=right valign=top><A HREF="ch21_26.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
</table>

&nbsp;
<hr align=left width=515>
</DIV>
<DIV CLASS=refnamediv>
<H1>PaintEvent <img src="gifs/bstar.gif" alt="(New)" border=0></H1>

<H2>Name</H2>

PaintEvent <img src="gifs/bstar.gif" alt="(New)" border=0>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch21-REFSECT1-AUTOID.139"></A></h2>
</DIV>


<p>
<img align=middle src="./figs/paintev.gif" alt="[Graphic: Figure from the text]" width=502 height=92 border=0>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch21-REFSECT1-AUTOID.140">Description</A></h2>

<P CLASS=para>
The <tt CLASS=literal>PaintEvent</tt> class represents 
the paint and update operations that the AWT performs on components. There 
is no <tt CLASS=literal>PaintListener</tt> interface, 
so the only way to catch these events is to override <tt CLASS=literal>paint(Graphics)</tt> 
and <tt CLASS=literal>update(Graphics)</tt> in <tt CLASS=literal>Component</tt>. 
This class exists so that paint events will get serialized properly. 

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch21-REFSECT1-AUTOID.141">Class Definition</A></h2>

<DIV CLASS=screen>
<P>
<PRE>
public class java.awt.event.PaintEvent
   extends java.awt.event.ComponentEvent {
  // Constants
  public final static int PAINT;
  public final static int PAINT_FIRST;
  public final static int PAINT_LAST;
  public final static int UPDATE;
  // Constructor
  public PaintEvent (Component source, int id, Rectangle updateRect);
  // Instance Methods
  public Rectangle getUpdateRect();
  public String paramString();
  public void setUpdateRect (Rectangle updateRect);
}
</PRE>
</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch21-REFSECT1-AUTOID.142">Class Definition</A></h2>

<DIV CLASS=screen>
<P>
<PRE>
public class java.awt.event.PaintEvent
        extends java.awt.event.ComponentEvent {
  // Constants
  public final static int PAINT;
  public final static int PAINT_FIRST;
  public final static int PAINT_LAST;
  public final static int UPDATE;
  //Constructor
  public PaintEvent (Component source, int id, Rectangle updateRect);
  // Instance Methods
  public Rectangle getUpdateRect();
  public String paramString();
  public void setUpdateRect (Rectangle updateRect);
}
</PRE>
</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch21-REFSECT1-AUTOID.143">Constants</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch21-REFSECT2-AUTOID.255">PAINT</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch21-REFSECT3-AUTOID.257">public final static int PAINT</A></h4>

<P CLASS=para>
The paint event type. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch21-REFSECT2-AUTOID.256">PAINT_FIRST</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch21-REFSECT3-AUTOID.258">public final static int PAINT_FIRST</A></h4>

<P CLASS=para>
Specifies the beginning range of paint event ID values. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch21-REFSECT2-AUTOID.257">PAINT_LAST</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch21-REFSECT3-AUTOID.259">public final static int PAINT_LAST</A></h4>

<P CLASS=para>
Specifies the ending range of paint event ID values. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch21-REFSECT2-AUTOID.258">UPDATE</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch21-REFSECT3-AUTOID.260">public final static int UPDATE</A></h4>

<P CLASS=para>
The update event type. 

</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch21-REFSECT1-AUTOID.144">Constructor</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch21-REFSECT2-AUTOID.259">PaintEvent</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch21-REFSECT3-AUTOID.261">public PaintEvent (Component source, ind id, Rectangle updateRect)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P CLASS=para>
<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>source</I><br>
<DD>

<P CLASS=para>
The source of the 
event.

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>id</I><br>
<DD>

<P CLASS=para>
The event type ID.

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>g</I><br>
<DD>

<P CLASS=para>
The rectangular area to paint.</DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Constructs a <tt CLASS=literal>PaintEvent</tt> with 
the given characteristics. </DL>
</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch21-REFSECT1-AUTOID.145">Instance Methods</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch21-REFSECT2-AUTOID.260">getUpdateRect</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch21-REFSECT3-AUTOID.262">public Rectangle getUpdateRect()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The rectangular area that needs painting.</DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch21-REFSECT2-AUTOID.261">paramString</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch21-REFSECT3-AUTOID.263">public String paramString()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
String with current settings of the <tt CLASS=literal>PaintEvent</tt>. 

<p>
<DT CLASS=varlistentry>Overrides<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>ComponentEvent</tt><tt CLASS=literal>.paramString()</tt> 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Helper method for <tt CLASS=literal>toString()</tt> 
to generate string of current settings. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch21-REFSECT2-AUTOID.262">setUpdateRect</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch21-REFSECT3-AUTOID.264">public void setUpdateRect (Rectangle updateRect)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P CLASS=para>
<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>updateRect</I><br>
<DD>

<P CLASS=para>
The rectangular area to paint. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Changes the rectangular area that this <tt CLASS=literal>PaintEvent</tt> will paint.</DL>
</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch21-REFSECT1-AUTOID.146">See Also</A></h2>

<P CLASS=para>
<tt CLASS=literal>Component</tt>, <tt CLASS=literal>ComponentEvent</tt>, 
<tt CLASS=literal>Graphics</tt> 

</DIV>


<DIV CLASS=htmlnav>

<P>
<HR align=left width=515>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch21_24.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><a href="index.htm"><img src='gifs/txthome.gif' border=0 alt='Home'></a></td>
<td width=172 align=right valign=top><A HREF="ch21_26.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
<tr>
<td width=172 align=left valign=top>MouseMotionListener <img src="gifs/bstar.gif" alt="(New)" border=0></td>
<td width=171 align=center valign=top><a href="index/idx_a.htm"><img src='gifs/index.gif' alt='Book Index' border=0></a></td>
<td width=172 align=right valign=top>TextEvent <img src="gifs/bstar.gif" alt="(New)" border=0></td>
</tr>
</table>
<hr align=left width=515>

<IMG SRC="gifs/smnavbar.gif" USEMAP="#map" BORDER=0> 
<MAP NAME="map"> 
<AREA SHAPE=RECT COORDS="0,0,108,15" HREF="../javanut/index.htm"
alt="Java in a Nutshell"> 
<AREA SHAPE=RECT COORDS="109,0,200,15" HREF="../langref/index.htm" 
alt="Java Language Reference"> 
<AREA SHAPE=RECT COORDS="203,0,290,15" HREF="../awt/index.htm" 
alt="Java AWT"> 
<AREA SHAPE=RECT COORDS="291,0,419,15" HREF="../fclass/index.htm" 
alt="Java Fundamental Classes"> 
<AREA SHAPE=RECT COORDS="421,0,514,15" HREF="../exp/index.htm" 
alt="Exploring Java"> 
</MAP>
</DIV>

</BODY>
</HTML>
